package com.xitest.spring.date20190304.demo.mvc.action;

import com.xitest.spring.date20190304.demo.service.IDemoService;
import com.xitest.spring.date20190304.springmvcframework.annotation.XiAutowired;
import com.xitest.spring.date20190304.springmvcframework.annotation.XiController;
import com.xitest.spring.date20190304.springmvcframework.annotation.XiRequestMapping;
import com.xitest.spring.date20190304.springmvcframework.annotation.XiRequestParam;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@XiController
@XiRequestMapping("/demo")
public class DemoAction {

  	@XiAutowired
	private IDemoService demoService;

	@XiRequestMapping("/select")
	public void select(HttpServletRequest req, HttpServletResponse resp,
					   @XiRequestParam("name") String name){
//		String result = demoService.get(name);
		String result = "My name is " + name;
		try {
			resp.getWriter().write(result);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
